package com.example.controller.buyer;

import com.example.entity.ExamStore;
import com.example.service.StoreService;
import com.example.vo.Result;
import com.example.vo.buyer.StoreDetailVo;
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description:
 * @Author: aimi
 * @Create: 2024-05-30
 **/
@RestController
@Slf4j
@RequestMapping("/buyer/store")
public class BuyerStoreController {
    @Autowired
    private StoreService storeService;

    @GetMapping("/common/getStoreDetail")
    public Result<StoreDetailVo> getStoreDetail(Long storeId){
        StoreDetailVo storeDetail = storeService.getStoreDetail(storeId);
        return Result.ok(storeDetail);
    }

    @PostMapping("/storeEntry")
    @Operation(summary = "店铺入驻")
    public Result storeEntry(@RequestBody ExamStore examStore){
        storeService.storeEntry(examStore);
        return Result.ok();
    }


    @GetMapping("/user/getByStoreId")
    public Result<Long> fetchUserIdByStoreId(@RequestParam("storeId") Long storeId){
        return storeService.fetchUserIdByStoreId(storeId);

    }
}